package daytrader.lib;

public final class Property {
	public static LibDataInterface libData;
	private static Object get(String stockName, String attr) {
		String oldFeed = libData.getCurrStockFeed();
		libData.openStockFeed(stockName);
		if (attr.equals("volume"))
			return libData.volume();
		else if (attr.equals("open"))
			return libData.open();
		else if (attr.equals("close"))
			return libData.close();
		else if (attr.equals("high"))
			return libData.high();
		else if (attr.equals("low"))
			return libData.low();
		else if (attr.equals("sector"))
			return libData.getSector(stockName);

		libData.openStockFeed(oldFeed);
		return 0;
	}
	public static double getd(String stockName, String attr) {
		return (Double) Property.get(stockName, attr);
	}
	
	public static String gets(String stockName, String attr) {
		return (String) Property.get(stockName, attr);
	}
	
	public static int geti(String stockName, String attr) {
		return Integer.parseInt(Property.get(stockName, attr).toString());
	}
	
	public static Boolean getb(String stockName, String attr) {
		return (Boolean) Property.get(stockName, attr);
	}
	
}
